from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
import os
import time

driver = webdriver.Chrome()
url = 'file:///' + os.path.abspath('html') + '/注册实例.html'
driver.get(url)

s1= driver.find_element(By.ID, 'select')
select = Select(s1)

time.sleep(2)
select.select_by_index(1)       #通过索引获取
time.sleep(2)
select.select_by_value('gz')        #通过value值获取
time.sleep(2)
select.select_by_visible_text('北京')     #通过文本获取
time.sleep(2)
driver.quit()